Skip to content

ASoC: SOF: client: Add character device driver (/dev/sof-dspN) - #6041

Draft
lgirdwood wants to merge 3 commits into
thesofproject:topic/sof-devfrom
lgirdwood:topic/sof-cdev
Draft

lgirdwood wants to merge 3 commits into
thesofproject:topic/sof-devfrom
lgirdwood:topic/sof-cdev

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Introduce the SOF auxiliary client character device driver (/dev/sof-dspN) and UAPI header (include/uapi/sound/sof/cdev.h) to expose DSP firmware debug, telemetry, IPC, memory window, LLEXT loading, Zephyr winstream shell/GDB, and probe interfaces to userspace tools (such as sof-remote-server / sof-top).

Summary of commits

  1. ASoC: SOF: client: Release ipc_client_mutex before deleting auxdev
    • Releases sdev->ipc_client_mutex before calling auxiliary_device_delete() / auxiliary_device_uninit() in sof_client_dev_unregister().
  2. ASoC: SOF: ipc4-loader: Add in-memory library buffer loader helper
    • Adds snd_sof_ipc4_load_library_from_buf() and exports sof_client_ipc4_load_library_buf() for loading rimage/LLEXT libraries from memory buffers, plus SOF_IPC4_DEBUG_SLOT_SHELL and SOF_IPC4_DEBUG_SLOT_LLEXT_LOAD definitions.
  3. ASoC: SOF: client: Add character device driver (/dev/sof-dspN)
    • Adds include/uapi/sound/sof/cdev.h and sound/soc/sof/sof-client-cdev.c (CONFIG_SND_SOC_SOF_CLIENT_CDEV) supporting:
      • SOF_IOC_GET_INFO: Device, firmware version, core mask, SRAM windows, and Window 2 debug slot descriptors
      • SOF_IOC_PM_CTL: Query state, wake & hold D0 (holding_d0), release hold, boot DSP, and core get/put
      • SOF_IOC_IPC_TX / SOF_IOC_IPC_LARGE_CFG: Atomic IPC3/IPC4 transactions and module large configs
      • SOF_IOC_WIN_INFO / SOF_IOC_WIN_READ / SOF_IOC_WIN_WRITE + mmap(): Direct SRAM window and debug-slot access
      • SOF_IOC_WINSTREAM_IO: Zephyr winstream ring-buffer I/O (SOF_CDEV_SLOT_SHELL, SOF_CDEV_SLOT_GDB_STUB)
      • SOF_IOC_LLEXT_LOAD: Shell shm handshake and direct IPC4 library loading
      • SOF_IOC_PROBE_CTL: Probe init/deinit, active/available query, and point add/remove
      • poll() / read(): Async SOF_CDEV_EVT_FW_STATE and SOF_CDEV_EVT_IPC_NOTIFICATION event queue

Verification (on sof/topic/sof-dev)

  • Built sound/soc/sof/sof-client-cdev.o, sound/soc/sof/sof-client.o, and sound/soc/sof/ipc4-loader.o with W=1 cleanly.
  • Verified UAPI header compilation via make headers_install + gcc -Wall -Wextra -Werror on <sound/sof/cdev.h>.
  • Ran scripts/checkpatch.pl (0 errors on cdev.h and sof-client-cdev.c; fixed Kconfig recursive dependency and kzalloc_obj style warnings while extracting from the local working tree).

Note: Created from the clean cdev subset of the local linux-dragon-fly WIP working tree, rebased onto sof/topic/sof-dev.

Drop ipc_client_mutex before calling auxiliary_device_delete() and
auxiliary_device_uninit() in sof_client_dev_unregister(), matching
sof_client_dev_register() and avoiding holding the list lock across
client driver remove() callbacks.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add snd_sof_ipc4_load_library_from_buf() and expose
sof_client_ipc4_load_library_buf() for loading rimage/LLEXT libraries
from a host memory buffer, along with debug window slot definitions for
the Zephyr winstream shell and LLEXT load rendezvous.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add an auxiliary SOF client driver creating /dev/sof-dspN and its UAPI
header include/uapi/sound/sof/cdev.h, exposing:
- Device, firmware, and SRAM window/slot discovery (SOF_IOC_GET_INFO)
- Power and per-core state control (SOF_IOC_PM_CTL)
- Atomic IPC3/IPC4 transactions and large configs
- SRAM window/debug-slot read/write and mmap
- Zephyr winstream shell/GDB I/O (SOF_IOC_WINSTREAM_IO)
- LLEXT library loading (SOF_IOC_LLEXT_LOAD)
- SOF probe point control (SOF_IOC_PROBE_CTL)
- Async firmware state and IPC notification events via poll()/read()

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants